import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

/*
  路由：体现对应关系,更专业来说就是一种映射
  生活中的路由：ip地址和设备的对应关系
  前端路由：地址栏上的地址视图（组件）的对应关系  -- 其他都是了解，我们重点掌握这个
  后端路由：请求路径和接口函数的对应关系
*/

const routes = [{
        path: '/',
        name: 'Home',
        component: Home
    },
    {
        path: '/about',
        name: 'About',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/About.vue')
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router